package net.hn.hnms.biz.blueprint.request;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;

/**
 * Created on 2022/09/13.
 *
 * @author wangjr
 * @desc:
 */
@Data
public class FileInfoReq {

    @ApiModelProperty(value = "目录Id")
    @NotBlank(message = "目录Id不能为空")
    private String catalogId;

    @ApiModelProperty(value = "文件名称")
    private String fileName;

    @ApiModelProperty(value = "创建人")
    private String username;

    @ApiModelProperty(value = "文件分类")
    private String fileTypeId;

    @ApiModelProperty(value = "文件格式")
    private String suffixType;

    private List<String> dateTimeRange;

    @ApiModelProperty(value = "煤矿编码")
    private String mineCode;

    @ApiModelProperty(value = "公司编码")
    private String companyCode;

    @ApiModelProperty(value = "文件名称")
    private String fileTypeName;

    public Date getBeginDate() {
        if (dateTimeRange != null && dateTimeRange.size() > 0) {
            return StrUtil.isNotBlank(dateTimeRange.get(0)) ? DateUtil.parseDate(dateTimeRange.get(0)) : null;
        }
        return null;
    }

    public Date getEndDate() {
        if (dateTimeRange != null && dateTimeRange.size() > 1) {
            return StrUtil.isNotBlank(dateTimeRange.get(1)) ?DateUtil.parseDate(dateTimeRange.get(1)) : null;
        }
        return null;
    }
}
